package com.example.zk.adapter

import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.base.entity.CategoryEntity
import com.example.zk.R

class TwoAdapter:BaseQuickAdapter<CategoryEntity,BaseViewHolder>(R.layout.item_two) {
    override fun convert(holder: BaseViewHolder, item: CategoryEntity) {
        holder.setText(R.id.two_title,item.name)
        val recyclerView1 = holder.getView<RecyclerView>(R.id.rv_child)
        val childAdapter = ChildAdapter()
        childAdapter.data.clear()
        childAdapter.data.addAll(item.child)
        recyclerView1.adapter = childAdapter
        recyclerView1.layoutManager = GridLayoutManager(context,3)
    }
}